<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>测试正则1</title>
</head>
<body>
<script type="text/javascript">
    var str = "does";
    var patt1 = /do(es)?/;
    //返回的是一个数组,用数组中的第一个就行了
    document.write(str.match(patt1));
</script>
</body>
</html>